home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Grapevine 12
/
Grapevine_12_1994-10-25_TDR_Side_A.d64
/
ass.irq ldr 0.7
next >
Wrap
Text File
|
2023-02-26
|
7KB
|
290 lines
;--- WHIPLOADER IRQ 0.7 ---
ciout = $ffa8 ;Output byte to ser.
listen = $ffb1
second = $ff93
unlsn = $ffae
*= $c000
ldx #<load ;Set LOAD vector.
ldy #>load
stx $0330
sty $0331
rts
command ;Initialize for talking
lda $ba ;Device#
jsr listen
lda #$6f ;Sec addr
jsr second
lda #$4d ;"M"
jsr ciout
lda #$2d ;"-"
jsr ciout
txa ;"x"
jsr ciout
tya ;"y"
jmp ciout
load ;Actual LOAD.
stx $ae
sty $af
sta $93
tay ;Check if
beq notver ; LOAD or VERIFY.
normal jmp $f4a7 ;Normal LOAD.
notver sty $d015 ;Sprites off.
lda ($bb),y
cmp #$24
beq normal
jsr drvwait
lda $ba
jsr listen
lda #$f0
jsr second
ldy #0
nameloop lda ($bb),y
jsr ciout
iny
cpy $b7
bcc nameloop
jsr unlsn
jsr drvwait
ldy #$00 ;Lo address
writer ldx #$57 ;"W"rite
jsr command ;of drive mem
lda #$05 ;Hi address
jsr ciout ;(ie. $0500)
lda #$1c ;28 bytes
jsr ciout
tax ;Y-reg used as
writelp lda drvcode,y ; index and 'lo'
jsr ciout ; byte.
iny
dex
bne writelp
jsr unlsn
cpy #$d0 ;Do until all bytes
bcc writer ; written to drive.
ldx #$45 ;"E"xecute
ldy #<drvinit-drvcode
jsr command
lda #$05 ;hi (ie. JMP $05xx)
jsr ciout
jsr unlsn
lda $dd00
and #$07 ;Save $DD00 value.
sta savedd00+1
tax
ora #$10
sta $dd00
lda andbyte,x
sta adjdd00+1 ;Used to adjust
; byte just received 'cos
; of variable $DD00 value.
ldy #drvcode-locode
;Size of low code.
locodemv lda locode-1,y
sta $0100-1,y
dey
bne locodemv
jsr $0100
pha
jsr $0100 ;Get load address
pha ; & sect. pointer.
jsr $0100
tay
jsr $0100
ldx $b9 ;Secondary addrs.
beq comma0
sty $ae
sta $af
comma0 sty $c3 ;Address where prog
sta $c4 ; was saved.
pla
tax ;Prepare X-reg in case
dex ; first block is last.
dex
pla
jmp loading-locode+$0100
;Adjust for low memory.
drvwait ;Wait for drive to be ready.
lda $dd00
and #$07
ora #$08
sta $dd00
tax
waitloop lda $dd00
bpl waitloop
txa
and #$07
sta $dd00
rts
andbyte .byte $ff,$fe,$fd,$fc
.byte $fa,$fb,$f8,$f9
;---------------------------------------
locode ;Code works at $0100!
;Get a byte.
lda $dd00 ;Wait until drive
bpl locode ; is ready.
sei ;Interrupts off!!!!
savedd00 ldx #0 ;Prep register...
rastwait lda $d012
cmp #$31
bcc lineok ;In top/bot border.
and #$06 ;Ensure raster pos
cmp #$02 ; doesn't inerfere.
beq rastwait
lineok stx $dd00 ;Ready for transfer.
txa
ora #$10 ;Prep register...
tax
lda $02a6 ;Pause for NTSC/PAL
beq here ; compatibility. [?]
here nop
lda $dd00 ;Transfer byte Two
lsr a ; bits at a time.
lsr a
eor $dd00
lsr a
lsr a
eor $dd00
lsr a
lsr a
eor $dd00
adjdd00 eor #0
stx $dd00 ;Set 'wait'
cli
rts
getblock
sta $63 ;Save #bytes.
ldy #$00
blocklp jsr $0100
sta ($ae),y ; and store byte.
iny
cpy $63 ;Check if all bytes
; of sector transfered.
bne blocklp
tya
clc
adc $ae ;Increase Pointer.
sta $ae
bcc noinc
inc $af
noinc rts
loading
beq loadlast
lda #$fc
.byte $2c ;BIT
loadloop lda #$fe
jsr getblock-locode+$0100
jsr $0100
pha ;Get next Track and
jsr $0100 ; Sector values.
tax ;X-reg hold number
pla ; of bytes if last.
bne loadloop
loadlast dex
txa
jsr getblock-locode+$0100
jmp $f528 ;End load incl fix.
;---------------------------------------
drvcode ;Code moved into disk drive
; from $0500
lda #$03 ;Page where data
sta $31 ; is read into.
drvmainl jsr $0150 ;Transfered ROM.
ldy #$00
drvloop ldx $0300,y
lda $0600,x ;Get high nybble.
sta hisave-drvcode+$0501
txa
ldx #$00 ;Drive is ready.
stx $1800
and #$0f
tax
lda #$04;Wait until bit $04
drvwait1 bit $1800 ; is set by computer
bne drvwait1
lda sendbyte-drvcode+$0500,x
sta $1800
asl a
and #$0f
sta $1800
nop
hisave lda #0 ;Recall hi byte val.
sta $1800
asl a
and #$0f
sta $1800
lda #$02
iny
sta $1800 ;Restore serial bus
bne drvloop
lda $0301 ;Set Sector
sta $0b
sta $81
lda $0300
cmp $0a ;Keep going if
beq drvmainl ; same track.
sta $80
jmp $f418 ;Next Track
sendbyte .byte 0,8,2,10,4,12,6,14
.byte 1,9,3,11,5,13,7,15
drvinit ldy #$02
sty $1800
ldx #$00
drvhilp txa
lsr a ;Prepare high byte
lsr a ; values for better
lsr a ; speed.
lsr a
tay
lda sendbyte-drvcode+$0500,y
sta $0600,x
inx
bne drvhilp
ldx #$39
drvromc lda $f4d0,x ;Copy drive ROM.
sta $014f,x
dex
bne drvromc
lda #$60 ;'RTS'
sta $0184
lda $19 ;First trck & sect
sta $0b ; copy to used one
lda $18
drvloop2 sta $0a
ldx #$02
stx $f9
lda #$e0
jsr $d57d
dec $0298
jsr $d599
cmp #$02
bcs drverr
lda $80
bne drvloop2
jmp $c194
drverr jmp $e60a